#include "../idlib/precompiled.h"
#include "NuPlay.h"
#include "OSCDispatcher.h"
#include "Game_local.h"
#include "Camera.h"

NuPlay::NuPlay()
{
	nuplay_dispatcher = new OSCDispatcher();
}

void NuPlay::Init() 
{
	if (nuplay_dispatcher) {
		nuplay_dispatcher->start();
	}
}

OSCDispatcher * NuPlay::GetDispatcher() {
	return nuplay_dispatcher;
}


void NuPlay::InitAfterMapLoad() {
	idEntity*	ent;

	for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
			if (ent->IsType(idTrigger_NuPlayCameraInit::GetClassType())) {
			idTrigger_NuPlayCameraInit* trigger;
			trigger = static_cast<idTrigger_NuPlayCameraInit*>( ent );
			trigger->TriggerAction();
			break;
		}
	}

}

NuPlay::~NuPlay(void)
{
	if (nuplay_dispatcher) {
		nuplay_dispatcher->stop();
		nuplay_dispatcher = NULL;
	}
}

